package com.yxkj.syh.app.huarong.activities.home.notice;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.syh.app.basic.base.view_model.BaseViewModel;
import com.syh.app.basic.utils.Tooast;
import com.syh.app.basic.utils.net.ApiObserver;
import com.trello.rxlifecycle2.android.ActivityEvent;
import com.yxkj.syh.app.huarong.bean.NoticeResponse;
import com.yxkj.syh.app.huarong.bean.PagesRequest;
import com.yxkj.syh.app.huarong.data_center.model.CommonModel;

/**
 * 创建者：SYH
 * 时间：2020/5/21 14:04
 * 编辑者：SYH、
 * 标签：
 * 补充说明：
 */
public class NoticeListVM extends BaseViewModel<ActivityEvent> {
    public NoticeListVM(@NonNull Application application) {
        super(application);
    }
    public MutableLiveData<NoticeResponse.Data> mldNotice = new MutableLiveData();

    public void notice(PagesRequest request){


        CommonModel.getCommonModel().notice(request,mLifecycleProvider.bindToLifecycle(), new ApiObserver<NoticeResponse>() {
            @Override
            public void onSuccess(NoticeResponse noticeResponse) {
                mldNotice.setValue(noticeResponse.getData());
            }

            @Override
            public void onFailed(int code, String msg) {
                Tooast.warning(msg);
            }
        });
    }
}
